package net.jlibrary.invoice.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.BatchSize;

import net.jlibrary.common.core.annotation.CodeGenComment;
import net.jlibrary.common.core.annotation.SearchCondition;
import net.jlibrary.common.core.annotation.SearchField;
import net.jlibrary.common.core.entity.BaseObject;
import net.jlibrary.curbparking.domain.PlateNumber;

@Entity(name = "tab_electronic_invoicegfinfo")
//@SeePurview(value = "member.group.globalPath")
@BatchSize(size = 15)
@CodeGenComment(value = "购方信息", genSelect = false, add = false, update = false, delete = false)
public class ElectronicInvoiceGfInfo extends BaseObject {
	private static final long serialVersionUID = -7201010404058565662L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@SearchField(value = "id", condition = SearchCondition.EQUAL)
	private Long id;

	@Column(length = 20)
	@CodeGenComment(value = "购方单位名称", viewList = true, required = true)
	private String ghdwmc;

	@Column(length = 100)
	@SearchField(value = "ghdwsbh", condition = SearchCondition.EQUAL)
	@CodeGenComment(value = "购方单位税号", viewList = true, required = true)
	private String ghdwsbh;

	@Column(length = 100)
	@CodeGenComment(value = "购方单位地址", viewList = true, required = true)
	private String ghdwdz;

	@Column(length = 100)
	@CodeGenComment(value = "购方单位电话 ", viewList = true, required = true)
	private String ghdwdh;

	@Column(length = 100)
	@CodeGenComment(value = "购方单位银行名称", viewList = true, required = true)
	private String ghdwyhmc;

	@Column(length = 100)
	@CodeGenComment(value = "购方单位银行", viewList = true, required = true)
	private String ghdwyh;

	@Column(length = 40)
	@CodeGenComment(value = "购方邮箱", viewList = true, required = true)
	private String gfkhyx;

	//
//	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
//	@JoinColumn(name = "plateNumber_id")
//	@SearchField(value = "plateNumber", condition = SearchCondition.EQUAL)
//	@CodeGenComment(value = "关联车牌", viewList = false, viewSearch = true, required = true)
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "plateNumber_id")
	@CodeGenComment(value = "车牌", viewList = true, required = true)
	private PlateNumber plateNumber;// 车牌

//	@ManyToOne(fetch = FetchType.LAZY)
//	@JoinColumn(name = "member_id")
//	@SearchField(value = "member", condition = SearchCondition.EQUAL)
//	@CodeGenComment(value = "关联会员", viewList = false, viewSearch = true, required = true)
//	private Member member;
	@Column(updatable = false)
	@Temporal(TemporalType.TIMESTAMP)
	@CodeGenComment(value = "创建时间", viewList = true)
	private Date createdate;
	@Temporal(TemporalType.TIMESTAMP)
	private Date lastdate;

	public Long getId() {
		return id;
	}

	public PlateNumber getPlateNumber() {
		return plateNumber;
	}

	public void setPlateNumber(PlateNumber plateNumber) {
		this.plateNumber = plateNumber;
	}

	@Override
	public Serializable getPrimaryKey() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Date getCreatedate() {
		return createdate;
	}

	public void setCreatedate(Date createdate) {
		this.createdate = createdate;
	}

	public Date getLastdate() {
		return lastdate;
	}

	public void setLastdate(Date lastdate) {
		this.lastdate = lastdate;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ElectronicInvoiceGfInfo other = (ElectronicInvoiceGfInfo) obj;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		return true;
	}

	public String getGhdwmc() {
		return ghdwmc;
	}

	public void setGhdwmc(String ghdwmc) {
		this.ghdwmc = ghdwmc;
	}

	public String getGhdwsbh() {
		return ghdwsbh;
	}

	public void setGhdwsbh(String ghdwsbh) {
		this.ghdwsbh = ghdwsbh;
	}

	public String getGhdwdz() {
		return ghdwdz;
	}

	public void setGhdwdz(String ghdwdz) {
		this.ghdwdz = ghdwdz;
	}

	public String getGhdwdh() {
		return ghdwdh;
	}

	public void setGhdwdh(String ghdwdh) {
		this.ghdwdh = ghdwdh;
	}

	public String getGhdwyhmc() {
		return ghdwyhmc;
	}

	public void setGhdwyhmc(String ghdwyhmc) {
		this.ghdwyhmc = ghdwyhmc;
	}

	public String getGhdwyh() {
		return ghdwyh;
	}

	public void setGhdwyh(String ghdwyh) {
		this.ghdwyh = ghdwyh;
	}

	public String getGfkhyx() {
		return gfkhyx;
	}

	public void setGfkhyx(String gfkhyx) {
		this.gfkhyx = gfkhyx;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@Override
	public String toString() {
		return "ElectronicInvoiceGfInfo [id=" + id + ", ghdwmc=" + ghdwmc + ", ghdwsbh=" + ghdwsbh + ", ghdwdz="
				+ ghdwdz + ", ghdwdh=" + ghdwdh + ", ghdwyhmc=" + ghdwyhmc + ", ghdwyh=" + ghdwyh + ", gfkhyx=" + gfkhyx
				+ ", plateNumber=" + plateNumber + ", createdate=" + createdate + ", lastdate=" + lastdate + "]";
	}

}
